<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="<s:url value='/resources/css/car.css'/>"/>
<link rel="stylesheet" type="text/css" href="<s:url value='/resources/css/shop/top.css'/>"/>
<script src="<s:url value='/resources/js/jquery/jquery-1.5.2.min.js'/>" type="text/javascript"></script>
<script src="<s:url value='/resources/js/common/time.js'/>" type="text/javascript"></script>
<script type="text/javascript">
var contextpath="<%=request.getContextPath()%>";
var placeId = '<s:property value="#request.placeId"/>';
var numPager = <s:property value="#request.total"/>;
var pagesize = <s:property value="#request.pagesize"/>;
var current = <s:property value="#request.current"/>;
$(function(){
	var loading = false;
	$('#nowTime').createTime({format:'yyyy/MM/dd EEE hh:mm:ss'});
	$('.prev').bind('click', function(){
		if(current == 1 || loading)return;
		var param = {'page': current-1,'rows':pagesize,'placeId':placeId};
		ajaxRequest(param);
	}).bind('mouseover',function(){
		if(current == 1 || loading){
			$(this).addClass('prev-hover');
			return;
		}
		$(this).removeClass('prev-hover');
		
	}).bind('mouseout',function(){
		$(this).addClass('prev-hover');
	});
	$('.next').bind('click', function(){
		if(current == numPager || loading)return;
		var param = {'page': current+1,'rows':pagesize,'placeId':placeId};
		ajaxRequest(param);
	}).bind('mouseover',function(){
		if(current == numPager || loading){
			$(this).addClass('next-hover');
			return;
		}
		$(this).removeClass('next-hover');
		
	}).bind('mouseout',function(){
		$(this).addClass('next-hover');
	});
	
	$('.back').click(function(){
		window.location.href = '<s:url value="/car/index.do?placeId=%{#request.placeId}"/>';
	});
	
	function ajaxRequest(param){
		loading = true;
		$.post(contextpath+'/car/findArrivePager.do', param, function(data){
			if(typeof data == 'string') data = eval('('+ data +')');
			var total = $.isArray(data)?data.length: data.total;
			var rows = $.isArray(data)?data: data.rows;
			numPager = Math.ceil(total/pagesize);
			current = param.page;
			$('#current').text(current);
			var innerHtml = '';
			for(var x in rows){
				var row = rows[x];
				innerHtml += '<table class="table" border="1px" cellspacing="0"> <thead> <tr> <td width="110">旅行社</td>';
				innerHtml += '<td width="220" class="val">'+ row.travelName +'</td>';
				innerHtml += '<td width="110">旅行团</td>';
				innerHtml += '<td class="val">'+ row.tourName +'</td>';
				innerHtml += '</tr>';
				innerHtml += '</thead>';
				innerHtml += '<tbody>';
				innerHtml += '<tr>';
				innerHtml += '<td class="name">导游</td>';
				innerHtml += '<td colspan="3">'+ row.guideName +'（电话号码：'+ row.guidePhone +'）';
				innerHtml += '</td>';
				innerHtml += '</tr>';
				innerHtml += '<tr>';
				innerHtml += '<td class="name">行程编号</td>';
				innerHtml += '<td>'+ row.tourCode +'</td>';
				innerHtml += '<td class="name">总人数</td>';
				innerHtml += '<td>'+ row.total +'</td>';
				innerHtml += '</tr>';
				innerHtml += '<tr>';
				innerHtml += '<td class="name">司机</td>';
				innerHtml += '<td>'+ row.driver +'</td>';
				innerHtml += '<td class="name">车牌号</td>';
				innerHtml += '<td>'+ row.carNumber +'</td>';
				innerHtml += '</tr>';
				innerHtml += '<tr>';
				innerHtml += '<td class="name">电子车牌</td>';
				innerHtml += '<td>'+ row.enumber +'</td>';
				innerHtml += '<td class="name">&nbsp;</td>';
				innerHtml += '<td>&nbsp;</td>';
				innerHtml += '</tr>';
				innerHtml += '<tr>';
				innerHtml += '<td class="name">到达时间</td>';
				innerHtml += '<td>'+ row.arriveTime +'</td>';
				innerHtml += '<td class="name">离开时间</td>';
				innerHtml += '<td>'+ (row.leaveTime==null?'':row.leaveTime) +'</td>';
				innerHtml += '</tr>';
				innerHtml += '</tbody>';
				innerHtml += '</table>';
			}
			$('#pageShow').empty().html(innerHtml);
			loading = false;
		});
	}
});
</script>
<title>旅游车主界面</title>
</head>
<body style="overflow: hidden; padding:0; margin: 0;" scroll="no">
<div class="main">
	<div id="top">
		<div class="home"></div>
		<div class="sysname" style="font-family:'微软雅黑';">现代旅游车辆监控系统</div>
		<div class="user"></div>
		<div class="userText">操作员:000001</div>
		<div class="time" id="nowTime"><s:date name="#request.time" format="yyyy/MM/dd EEE HH:mm:ss"/></div>
		<div class="clr"></div>
	</div>
	<div class="main-content">
	<div class="arriveList">今日到达车辆：<s:property value="#request.length"/>辆</div>
	<div id="pageShow">
	<s:iterator var="vo" value="#request.vos">
	<table class="table" border="1px" cellspacing="0">
		<thead>
			<tr>
				<td width="110">旅行社</td>
				<td width="220" class="val"><s:property value="#vo.travelName"/></td>
				<td width="110">旅行团</td>
				<td class="val"><s:property value="#vo.tourName"/></td>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td class="name">导游</td>
				<td colspan="3">
				<s:property value="#vo.guideName"/>
				（电话号码：<s:property value="#vo.guidePhone"/>）
				</td>
			</tr>
			<tr>
				<td class="name">行程编号</td>
				<td><s:property value="#vo.tourCode"/></td>
				<td class="name">总人数</td>
				<td><s:property value="#vo.total"/></td>
			</tr>
			<tr>
				<td class="name">司机</td>
				<td><s:property value="#vo.driver"/></td>
				<td class="name">车牌号</td>
				<td><s:property value="#vo.carNumber"/></td>
			</tr>
			<tr>
				<td class="name">电子车牌</td>
				<td><s:property value="#vo.enumber"/></td>
				<td class="name">&nbsp;</td>
				<td>&nbsp;</td>
			</tr>
			<tr>
				<td class="name">到达时间</td>
				<td><s:date name="#vo.arriveTime" format="yyyy-MM-dd HH:mm"/></td>
				<td class="name">离开时间</td>
				<td><s:date name="#vo.leaveTime" format="yyyy-MM-dd HH:mm"/></td>
			</tr>
		</tbody>
	</table>
	</s:iterator>
	</div>
	<div class="prev prev-hover"></div>
	<div class="next next-hover"></div>
	<div class="page"><span id="current" style="color:red;"><s:property value="#request.current"/></span>/<s:property value="#request.total"/></div>
	</div>
	<div class="back">返回</div>
</div>

</body>
</html>